package com.anyou.mall.fin.service.impl;

import java.util.List;

import com.anyou.common.core.domain.ApiResult;
import com.anyou.common.utils.DateUtils;
import com.anyou.mall.fin.vo.AllOrderAmountVo;
import com.anyou.mall.fin.vo.OrderAmountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.anyou.mall.fin.mapper.OrderAmountMapper;
import com.anyou.mall.fin.domain.OrderAmount;
import com.anyou.mall.fin.service.IOrderAmountService;

/**
 * 订单金额管理Service业务层处理
 * 
 * @author gaochaohao
 * @date 2022-04-25
 */
@Service
public class OrderAmountServiceImpl implements IOrderAmountService 
{
    @Autowired
    private OrderAmountMapper orderAmountMapper;

    /**
     * 查询订单金额管理
     * 
     * @param orderAmountId 订单金额管理主键
     * @return 订单金额管理
     */
    @Override
    public OrderAmount selectOrderAmountByOrderAmountId(Long orderAmountId)
    {
        return orderAmountMapper.selectOrderAmountByOrderAmountId(orderAmountId);
    }

    /**
     * 查询订单金额管理列表
     * 
     * @param orderAmount 订单金额管理
     * @return 订单金额管理
     */
    @Override
    public List<OrderAmountVo> selectOrderAmountList(OrderAmount orderAmount)
    {
        return orderAmountMapper.selectOrderAmountList(orderAmount);
    }

    /**
     * 新增订单金额管理
     * 
     * @param orderAmount 订单金额管理
     * @return 结果
     */
    @Override
    public int insertOrderAmount(OrderAmount orderAmount)
    {
        orderAmount.setCreateTime(DateUtils.getNowDate());
        return orderAmountMapper.insertOrderAmount(orderAmount);
    }

    /**
     * 修改订单金额管理
     * 
     * @param orderAmount 订单金额管理
     * @return 结果
     */
    @Override
    public int updateOrderAmount(OrderAmount orderAmount)
    {
        orderAmount.setUpdateTime(DateUtils.getNowDate());
        return orderAmountMapper.updateOrderAmount(orderAmount);
    }

    /**
     * 批量删除订单金额管理
     * 
     * @param orderAmountIds 需要删除的订单金额管理主键
     * @return 结果
     */
    @Override
    public int deleteOrderAmountByOrderAmountIds(Long[] orderAmountIds)
    {
        return orderAmountMapper.deleteOrderAmountByOrderAmountIds(orderAmountIds);
    }

    /**
     * 删除订单金额管理信息
     * 
     * @param orderAmountId 订单金额管理主键
     * @return 结果
     */
    @Override
    public int deleteOrderAmountByOrderAmountId(Long orderAmountId)
    {
        return orderAmountMapper.deleteOrderAmountByOrderAmountId(orderAmountId);
    }

    @Override
    public ApiResult<AllOrderAmountVo> allOrderAmount() {
        AllOrderAmountVo allOrderAmountVo = orderAmountMapper.allOrderAmount();
        return ApiResult.success(allOrderAmountVo);
    }
}
